package cn.hs.service.impl;

import cn.hs.entity.Heartknowledge;
import cn.hs.mapper.HeartknowledgeMapper;
import cn.hs.service.HeartknowledgeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @ClassName HeartknowledgeServiceImpl
 * @Description TODO
 * @Author yyk
 * @Date 2024年10月23日 14:19
 * @Version 1.0
 */

@Service
public class HeartknowledgeServiceImpl implements HeartknowledgeService {
@Autowired
    private HeartknowledgeMapper heartknowledgeMapper;


    @Override
    public PageInfo findAll(Heartknowledge heartknowledge, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Heartknowledge> list = heartknowledgeMapper.findAll(heartknowledge);
        PageInfo<Heartknowledge> pageInfo = new PageInfo<>(list);
        return pageInfo;


    }

    @Override
    public int insert(Heartknowledge heartknowledge) {
        return heartknowledgeMapper.insert(heartknowledge);
    }

    @Override
    public int updateByPrimaryKeySelective(Heartknowledge heartknowledge) {
        return heartknowledgeMapper.updateByPrimaryKeySelective(heartknowledge);
    }

    @Override
    public int updateByPrimaryKey(Heartknowledge heartknowledge) {
        return heartknowledgeMapper.updateByPrimaryKey(heartknowledge);
    }

    @Override
    public int deleteByPrimaryKey(int id) {
        return heartknowledgeMapper.deleteByPrimaryKey((long) id);
    }

    @Override
    public Heartknowledge findById(Integer id)
    {
        Heartknowledge heartknowledge = heartknowledgeMapper.selectByPrimaryKey(Long.valueOf(id));
        return heartknowledge;
    }


}
